public class Test {
    //求斐波那契数列
    public static int fib(int n) {
        int f1 = 1;//代表前一项的前一项(针对:第n项)
        int f2 = 1;//代表前一项(针对:第n项)
        int f3 = 1;
        for (int i = 3; i <=n ; i++) {
            f3  = f1+f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;
    }
    public static void main(String[] args) {
      int a = fib(6);
        System.out.println(a);
    }
}
